#include <iostream>

using namespace std;

void test_reference_param_fucntion_overloaded();

void stuff(double &rs);				//matches modifialbe lvalue
void stuff(const double &rs);		//matches const lvalue, rvalue

void stove(double &r1);         //modifiable lvalue
void stove(const double &r2);   //const lvalue

#if 1
void stove(double &&r3);        //rvalue
#endif


int main(int argc, char const *argv[])
{
    test_reference_param_fucntion_overloaded();
    return 0;
}

void test_reference_param_fucntion_overloaded()
{
    double x = 5.1;
    const double y = 5.2;
    stove(x);           //match void stove(double &r1);
    stove(y);           //match void stove(const double &r2);
    stove(x + y);       //match void stove(double &&r3); If there is no declaration of 'void stove(double &&r3)', it will match 'void stove(const double &r2)'
}

void stove(double &r1)
{
    cout << "call stove(double &r1): " << r1 << endl;
}

void stove(const double &r2)
{
    cout << "call stove(const double &r2): " << r2 << endl;
}

void stove(double &&r3)
{
    cout << "call stove(double &&r3): " << r3 << endl;
}